package com.erp.erp_entitys.Blueprint;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * @author xumingbo
 * 图纸表
 */
@ApiModel(value = "图纸实体类")
@JsonIgnoreProperties(value = "handler")
public class BlueprintEntity implements Serializable {
    /**
     * 主键
     */
    @ApiModelProperty(value = "id")
    private Integer id;

    /**
     * 图纸编号
     */
    @ApiModelProperty(value = "图纸编号")
    @NotEmpty(message = "图纸编号不可为空")
    private String number;

    /**
     * 操作员
     */
    @ApiModelProperty(value = "操作员")
    private String operator;

    private String operatorName;

    /**
     * 创建日期
     * 单据新建日期
     */
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /**
     * 箱体状态
     * 1：草稿
     * 2：待批
     * 3：已批
     * 4：完成
     * 5：垃圾
     */
    @ApiModelProperty(value = "箱体状态")
    private String boxStatus;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    private String remark;

    /******** 关联数据 ********/
    @ApiModelProperty(value = "产品列表")
    private List<BlueprintProductEntity> productList;
    @ApiModelProperty(value = "附件列表")
    private List<BlueprintFileEntity> fileList;

    /****以下为查询参数  无对应字段 ******/

    /**
     * 图纸id集合
     */
    private List<String> idList;

    /**
     * 单据信息
     */
    private String numberLike;

    /**
     * 创建时间段
     */
    private Date startCreateTime;
    private Date endCreateTime;

    /**
     * 审批流id
     */
    private String bpmId;
    /**
     * 审批流状态
     */
    private String bpmStatus;

    /**
     * 图纸明细
     */
    List<BlueprintContent> blueprintContentList;

    public List<BlueprintContent> getBlueprintContentList() {
        return blueprintContentList;
    }

    public void setBlueprintContentList(List<BlueprintContent> blueprintContentList) {
        this.blueprintContentList = blueprintContentList;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getBoxStatus() {
        return boxStatus;
    }

    public void setBoxStatus(String boxStatus) {
        this.boxStatus = boxStatus;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public List<BlueprintProductEntity> getProductList() {
        return productList;
    }

    public void setProductList(List<BlueprintProductEntity> productList) {
        this.productList = productList;
    }

    public List<BlueprintFileEntity> getFileList() {
        return fileList;
    }

    public void setFileList(List<BlueprintFileEntity> fileList) {
        this.fileList = fileList;
    }

    public List<String> getIdList() {
        return idList;
    }

    public void setIdList(List<String> idList) {
        this.idList = idList;
    }

    public String getNumberLike() {
        return numberLike;
    }

    public void setNumberLike(String numberLike) {
        this.numberLike = numberLike;
    }

    public Date getStartCreateTime() {
        return startCreateTime;
    }

    public void setStartCreateTime(Date startCreateTime) {
        this.startCreateTime = startCreateTime;
    }

    public Date getEndCreateTime() {
        return endCreateTime;
    }

    public void setEndCreateTime(Date endCreateTime) {
        this.endCreateTime = endCreateTime;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getBpmId() {
        return bpmId;
    }

    public void setBpmId(String bpmId) {
        this.bpmId = bpmId;
    }

    public String getBpmStatus() {
        return bpmStatus;
    }

    public void setBpmStatus(String bpmStatus) {
        this.bpmStatus = bpmStatus;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BlueprintEntity that = (BlueprintEntity) o;
        return id.equals(that.id) &&
                Objects.equals(number, that.number) &&
                Objects.equals(operator, that.operator) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(boxStatus, that.boxStatus) &&
                Objects.equals(remark, that.remark);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, number, operator, createTime, boxStatus , remark);
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append(" \"id\":").append(id);
        sb.append(", \"number\":\"").append(number).append('\"');
        sb.append(", \"operator\":\"").append(operator).append('\"');
        sb.append(", \"createTime\":\"").append(createTime).append('\"');
        sb.append(", \"boxStatus\":\"").append(boxStatus).append('\"');
        sb.append(", \"remark\":\"").append(remark).append('\"');
        sb.append(", \"productList\":").append(productList);
        sb.append(", \"fileList\":").append(fileList);
        sb.append('}');
        return sb.toString();
    }
}